<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>OpenCV: cv::utils::BufferArea Class Reference</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../tutorial-utils.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
   &#160;<span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../d2/d75/namespacecv.html">cv</a></li><li class="navelem"><a class="el" href="../../d3/dc4/namespacecv_1_1utils.html">utils</a></li><li class="navelem"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html">BufferArea</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="../../d0/d24/classcv_1_1utils_1_1BufferArea-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">cv::utils::BufferArea Class Reference<div class="ingroups"><a class="el" href="../../d0/de1/group__core.html">Core functionality</a> &raquo; <a class="el" href="../../db/de0/group__core__utils.html">Utility and system functions and macros</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Manages memory block shared by muliple buffers.  
 <a href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#details">More...</a></p>

<p><code>#include &lt;opencv2/core/utils/buffer_area.private.hpp&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a5b705f2e08d8585753f9215c11ceaa34"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a5b705f2e08d8585753f9215c11ceaa34">BufferArea</a> (bool safe=false)</td></tr>
<tr class="memdesc:a5b705f2e08d8585753f9215c11ceaa34"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class constructor.  <a href="#a5b705f2e08d8585753f9215c11ceaa34">More...</a><br /></td></tr>
<tr class="separator:a5b705f2e08d8585753f9215c11ceaa34"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adf4923427bee24864cbc9e2bc1c8b016"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#adf4923427bee24864cbc9e2bc1c8b016">~BufferArea</a> ()</td></tr>
<tr class="memdesc:adf4923427bee24864cbc9e2bc1c8b016"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class destructor.  <a href="#adf4923427bee24864cbc9e2bc1c8b016">More...</a><br /></td></tr>
<tr class="separator:adf4923427bee24864cbc9e2bc1c8b016"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c8d6e5f29154b6601b292bdfeb8de66"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a6c8d6e5f29154b6601b292bdfeb8de66"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a6c8d6e5f29154b6601b292bdfeb8de66">allocate</a> (T *&amp;ptr, size_t count, <a class="el" href="../../d1/d1b/group__core__hal__interface.html#gab95f123a6c9bcfee6a343170ef8c5f69">ushort</a> alignment=sizeof(T))</td></tr>
<tr class="memdesc:a6c8d6e5f29154b6601b292bdfeb8de66"><td class="mdescLeft">&#160;</td><td class="mdescRight">Bind a pointer to local area.  <a href="#a6c8d6e5f29154b6601b292bdfeb8de66">More...</a><br /></td></tr>
<tr class="separator:a6c8d6e5f29154b6601b292bdfeb8de66"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9dcca9a53839a2061165e44bb99a902"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#ac9dcca9a53839a2061165e44bb99a902">commit</a> ()</td></tr>
<tr class="memdesc:ac9dcca9a53839a2061165e44bb99a902"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate memory and initialize all bound pointers.  <a href="#ac9dcca9a53839a2061165e44bb99a902">More...</a><br /></td></tr>
<tr class="separator:ac9dcca9a53839a2061165e44bb99a902"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7e2e02bc24906a4d13ef7905016d972c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a7e2e02bc24906a4d13ef7905016d972c">release</a> ()</td></tr>
<tr class="memdesc:a7e2e02bc24906a4d13ef7905016d972c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release all memory and unbind all pointers.  <a href="#a7e2e02bc24906a4d13ef7905016d972c">More...</a><br /></td></tr>
<tr class="separator:a7e2e02bc24906a4d13ef7905016d972c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a91af7f24be4aaa6481602192240fd97e"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a91af7f24be4aaa6481602192240fd97e"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a91af7f24be4aaa6481602192240fd97e">zeroFill</a> (T *&amp;ptr)</td></tr>
<tr class="memdesc:a91af7f24be4aaa6481602192240fd97e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fill one of buffers with zeroes.  <a href="#a91af7f24be4aaa6481602192240fd97e">More...</a><br /></td></tr>
<tr class="separator:a91af7f24be4aaa6481602192240fd97e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a24d2436cf4da69fc9961a14214cd77b5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a24d2436cf4da69fc9961a14214cd77b5">zeroFill</a> ()</td></tr>
<tr class="memdesc:a24d2436cf4da69fc9961a14214cd77b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fill all buffers with zeroes.  <a href="#a24d2436cf4da69fc9961a14214cd77b5">More...</a><br /></td></tr>
<tr class="separator:a24d2436cf4da69fc9961a14214cd77b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Manages memory block shared by muliple buffers. </p>
<p>This class allows to allocate one large memory block and split it into several smaller non-overlapping buffers. In safe mode each buffer allocation will be performed independently, this mode allows dynamic memory access instrumentation using valgrind or memory sanitizer.</p>
<p>Safe mode can be explicitly switched ON in constructor. It will also be enabled when compiling with memory sanitizer support or in runtime with the environment variable <code>OPENCV_BUFFER_AREA_ALWAYS_SAFE</code>.</p>
<p>Example of usage: </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> * buf1 = 0;</div><div class="line"><span class="keywordtype">double</span> * buf2 = 0;</div><div class="line">cv::util::BufferArea area;</div><div class="line">area.allocate(buf1, 200); <span class="comment">// buf1 = new int[200];</span></div><div class="line">area.allocate(buf2, 1000, 64); <span class="comment">// buf2 = new double[1000]; - aligned by 64</span></div><div class="line">area.commit();</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>This class is considered private and should be used only in OpenCV itself. API can be changed. </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a5b705f2e08d8585753f9215c11ceaa34"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5b705f2e08d8585753f9215c11ceaa34">&#9670;&nbsp;</a></span>BufferArea()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cv::utils::BufferArea::BufferArea </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>safe</em> = <code>false</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Class constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">safe</td><td>Enable <em>safe</em> operation mode, each allocation will be performed independently. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="adf4923427bee24864cbc9e2bc1c8b016"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adf4923427bee24864cbc9e2bc1c8b016">&#9670;&nbsp;</a></span>~BufferArea()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cv::utils::BufferArea::~BufferArea </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Class destructor. </p>
<p>All allocated memory well be freed. Each bound pointer will be reset to NULL. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a6c8d6e5f29154b6601b292bdfeb8de66"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6c8d6e5f29154b6601b292bdfeb8de66">&#9670;&nbsp;</a></span>allocate()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void cv::utils::BufferArea::allocate </td>
          <td>(</td>
          <td class="paramtype">T *&amp;&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../d1/d1b/group__core__hal__interface.html#gab95f123a6c9bcfee6a343170ef8c5f69">ushort</a>&#160;</td>
          <td class="paramname"><em>alignment</em> = <code>sizeof(T)</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Bind a pointer to local area. </p>
<p><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html" title="Manages memory block shared by muliple buffers. ">BufferArea</a> will store reference to the pointer and allocation parameters effectively owning the pointer and allocated memory. This operation has the same parameters and does the same job as the operator <code>new</code>, except allocation can be performed later during the <a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#ac9dcca9a53839a2061165e44bb99a902" title="Allocate memory and initialize all bound pointers. ">BufferArea::commit</a> call.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>Reference to a pointer of type T. Must be NULL </td></tr>
    <tr><td class="paramname">count</td><td>Count of objects to be allocated, it has the same meaning as in the operator <code>new</code>. </td></tr>
    <tr><td class="paramname">alignment</td><td>Alignment of allocated memory. same meaning as in the operator <code>new</code> (C++17). Must be divisible by sizeof(T). Must be power of two.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>In safe mode allocation will be performed immediatly. </dd></dl>

</div>
</div>
<a id="ac9dcca9a53839a2061165e44bb99a902"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9dcca9a53839a2061165e44bb99a902">&#9670;&nbsp;</a></span>commit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::utils::BufferArea::commit </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocate memory and initialize all bound pointers. </p>
<p>Each pointer bound to the area with the <a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a6c8d6e5f29154b6601b292bdfeb8de66" title="Bind a pointer to local area. ">BufferArea::allocate</a> will be initialized and will be set to point to a memory block with requested size and alignment.</p>
<dl class="section note"><dt>Note</dt><dd>Does nothing in safe mode as all allocations will be performed by <a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a6c8d6e5f29154b6601b292bdfeb8de66" title="Bind a pointer to local area. ">BufferArea::allocate</a> </dd></dl>

</div>
</div>
<a id="a7e2e02bc24906a4d13ef7905016d972c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7e2e02bc24906a4d13ef7905016d972c">&#9670;&nbsp;</a></span>release()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::utils::BufferArea::release </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Release all memory and unbind all pointers. </p>
<p>All memory will be freed and all pointers will be reset to NULL and untied from the area allowing to call <code>allocate</code> and <code>commit</code> again. </p>

</div>
</div>
<a id="a91af7f24be4aaa6481602192240fd97e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a91af7f24be4aaa6481602192240fd97e">&#9670;&nbsp;</a></span>zeroFill() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void cv::utils::BufferArea::zeroFill </td>
          <td>(</td>
          <td class="paramtype">T *&amp;&#160;</td>
          <td class="paramname"><em>ptr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Fill one of buffers with zeroes. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>pointer to memory block previously added using <a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#a6c8d6e5f29154b6601b292bdfeb8de66" title="Bind a pointer to local area. ">BufferArea::allocate</a></td></tr>
  </table>
  </dd>
</dl>
<p><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#ac9dcca9a53839a2061165e44bb99a902" title="Allocate memory and initialize all bound pointers. ">BufferArea::commit</a> must be called before using this method </p>

</div>
</div>
<a id="a24d2436cf4da69fc9961a14214cd77b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a24d2436cf4da69fc9961a14214cd77b5">&#9670;&nbsp;</a></span>zeroFill() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::utils::BufferArea::zeroFill </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fill all buffers with zeroes. </p>
<p><a class="el" href="../../d8/d2e/classcv_1_1utils_1_1BufferArea.html#ac9dcca9a53839a2061165e44bb99a902" title="Allocate memory and initialize all bound pointers. ">BufferArea::commit</a> must be called before using this method </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>opencv2/core/utils/<a class="el" href="../../dc/d4a/buffer__area_8private_8hpp.html">buffer_area.private.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:48 for OpenCV by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
